package com.wcgksoft.controller.saleMan;

import com.wcgksoft.common.util.Layui;
import com.wcgksoft.entity.admin.Account;
import com.wcgksoft.entity.system.SysUser;
import com.wcgksoft.service.system.UserService;
import net.sf.json.JSONObject;
import org.apache.shiro.SecurityUtils;
import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @author 御风
 * @version V1.0
 * @Package com.wcgksoft.controller.saleMan
 * @Description TODO 销售发展激活用户数
 * @date 2020/5/25 18:20
 * @ClassName SaleManDataController
 */
@Controller
@RequestMapping("saleMan/data")
public class SaleManDataController {

    @Autowired
    private UserService userService;

    @ResponseBody
    @RequestMapping(value = "findUserNumber")
    public Layui findUserNumber(){
        Account account =(Account) SecurityUtils.getSubject().getSession().getAttribute("om_user");
        DetachedCriteria criteria = DetachedCriteria.forClass(SysUser.class);
        criteria.add(Restrictions.eq("status",1));
        criteria.add(Restrictions.eq("isCross",0));
        criteria.add(Restrictions.eq("saleMan_id",account.getId()));
        List<SysUser> list = userService.findByConditions(criteria);
        return Layui.data(0, "success",1, list);
    }
}
